package com.weixin.project.Common.Enum;

public enum LikedStatus {
    UNLIKED(0,"未点赞/已取消"),
    LIKED(1,"论坛");
    private final Integer value;
    private final String filed;
    private LikedStatus(Integer value, String filed) {
        this.value = value;
        this.filed = filed;
    }
    public Integer getValue() {
        return value;
    }

    public String getFiled() {
        return filed;
    }

    public static LikedStatus codeOf(int code) {
        for (LikedStatus LikedStatus : values()) {
            if (LikedStatus.getValue() == code) {
                return LikedStatus;
            }
        }
        System.out.println("非法的code:" + code);
        return null;
    }

    public static LikedStatus reverse(LikedStatus status){
        if (status.getValue() == 0) return LIKED;
        else return UNLIKED;
    }

    public static boolean getBool(LikedStatus status){
        if (status.equals(LikedStatus.LIKED)) return true;
        else return false;
    }
}
